package com.passion.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @program offline-e-commerce-data-warehouse
 * @Description 常用的变量集合类
 * @Author limeihua
 * @Date 2024/09/28 18:25
 * @Version 1.0
 */
public class Constants {
    public static String REDIS_HOST;
    public static Integer REDIS_PORT;
    public static Integer REDIS_TIMEOUT;
    public static String HIVE_JDBC_URL;
    public static  String HIVE_JDBC_DRIVER;
    public static  String HIVE_USERNAME;

    static {
        Properties props = new Properties();
        InputStream in = null;
        try {
            in = Constants.class.getClassLoader().getResourceAsStream("config.properties");
            props.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            REDIS_HOST = props.getProperty("redis.host");
            REDIS_PORT = Integer.valueOf(props.getProperty("redis.port"));
            REDIS_TIMEOUT = Integer.valueOf(props.getProperty("redis.timeout"));
            HIVE_JDBC_URL = props.getProperty("hive.jdbc.url");
            HIVE_JDBC_DRIVER = props.getProperty("hive.jdbc.driver");
            HIVE_USERNAME = props.getProperty("hive.username");
        }
    }
}
